#!/bin/bash

# Copyright (C) 2010 Karel Zak <kzak@redhat.com>

TS_TOPDIR="${0%/*}/../.."
TS_DESC="options string"

. "$TS_TOPDIR"/functions.sh
ts_init "$*"

ts_check_test_command $TS_HELPER_LIBMOUNT_OPTLIST

TESTPROG="$TS_HELPER_LIBMOUNT_OPTLIST"

ts_init_subtest "append"
ts_run $TESTPROG --append-str "aaa,bbb=BBB,context=\"foo,bar,gogo\",ccc" "ddd" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "append-value"
ts_run $TESTPROG --append-str "aaa,bbb=BBB,ccc" "ddd=DDD" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "append-empty-value"
ts_run $TESTPROG --append-str "aaa,bbb=BBB,ccc" "ddd=" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "prepend"
ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "prepend-list"
ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd,eee=EEE,fff" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "prepend-value"
ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd=DDD" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "prepend-empty-value"
ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd=" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "set"
ts_run $TESTPROG --set-str "aaa,bbb=BBB,ccc" "new,data,for,list" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "get-str"
ts_run $TESTPROG --get-str "aaa,bbb=BBB,ccc,defaults" &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "get-str-linux"
ts_run $TESTPROG --get-str "noexec,noauto,user,defaults" linux &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "get-str-user"
ts_run $TESTPROG --get-str "noexec,noauto,user,defaults" user &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "get-flg-linux"
ts_run $TESTPROG --get-flg "noexec,noauto,user,defaults" linux &> $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "get-flg-user"
ts_run $TESTPROG --get-flg "noexec,noauto,user,defaults" user &> $TS_OUTPUT
ts_finalize_subtest

ts_finalize
